//
//  RAlertViewController.m
//  Riji
//
//  Created by liujianlong on 2022/8/18.
//

#import "RAlertViewController.h"

@interface RAlertViewController ()

@end

@implementation RAlertViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    [self.view layoutIfNeeded];
    self.modalPresentationStyle = UIModalPresentationOverFullScreen;
    self.view.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.6];
    return self;
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UIView *view = [self firstResponder:self.view];
    if (view != nil) {
        [super touchesEnded:touches withEvent:event];
        [self.view endEditing:YES];
    }else{
        UITouch *touch = [[touches allObjects] lastObject];
        if ([touch.view isDescendantOfView:self.view.subviews.firstObject] == NO) {
            [self dismissViewControllerAnimated:NO completion:nil];
        }
    }
}
@end
